#ifndef _M_FUNC_UART1_H_
#define _M_FUNC_UART1_H_

#define COM_MAX_BUF_SIZE  		512

/* the com2com return code */

#define SET_SN_CMD   0x01
#define SET_PW_CMD   0x02

#define DATA_FORMAT_ASCII   0
#define DATA_FORMAT_HEX     1

#define UART_USER_CMD_TAG   0x7E
#define UART_USER_CMD_END   0x7E

enum UART1_RET{
	UART1_ERR = -1,
	UART1_R_ERR = -2,
	UART1_INVALID_CMD = -3,
	UART1_OK = 0,
	UART1_NO_CMD = 1,
};

void  uart1_init (uint32_t uiBaudRate,
                  uint16_t usWordLength,
                  uint16_t usStopBits,
                  uint16_t usParity,
                  uint16_t usCtx);
int		uart1_recv_char(void);
int 	uart1_recv_data(unsigned char *pucBuf, unsigned short usSize);
int 	uart1_send_data(unsigned char *pucBuf, unsigned short usSize);
int   uart1_send_char(int iCh);

#endif

